from re import S, T
from numpy import square
from manimlib import *
#75cfb8
#bbdfc8
#f0e5d8
#ffc478
class p1(Scene):
    def construct(self):
        # self.add(NumberPlane())
        frame = self.camera.frame
        x=9/2
        width=2+4/3*x
        height=7/2+5*x/6
        a,b,c,d=[-width/2,height/2,0],[width/2,height/2,0],[width/2,-height/2,0],[-width/2,-height/2,0]
        p=Polygon(a,b,c,d)
        s1=Square(x).next_to(b,DL,buff=0).set_fill('#75cfb8',1)
        s2=Square((1+x)/2).next_to(c,UL,buff=0).set_fill('#ffc478',1)
        s3=s2.copy().shift(LEFT*(1+x)/2)
        s4=Square(1+x/3).next_to(d,UR,buff=0).set_fill('#bbdfc8',1)
        s5=Square(0.5+x/6).next_to(s4,UP,buff=0).shift(LEFT*(0.5+x/6)/2).set_fill('#f0e5d8',1)
        s6=Square(0.5+x/6).next_to(s4,UP,buff=0).shift(RIGHT*(0.5+x/6)/2).set_fill('#f0e5d8',1)
        s7=Square(2+x/3).next_to(a,DR,buff=0).set_fill(RED,1)
        self.add(p,s1,s2,s3,s4,s5,s6,s7)
        self.play(frame.animate.set_width(18))
        t=Tex('1').move_to([-1,-0.4,0])
        ts=Tex('?').move_to(s1.get_center())
        self.add(t,ts)
        self.wait()
class p1(Scene):
    def construct(self):
        # self.add(NumberPlane())
        frame = self.camera.frame
        x=9/2
        width=2+4/3*x
        height=7/2+5*x/6
        a,b,c,d=[-width/2,height/2,0],[width/2,height/2,0],[width/2,-height/2,0],[-width/2,-height/2,0]
        p=Polygon(a,b,c,d)
        s1=Square(x).next_to(b,DL,buff=0).set_fill('#75cfb8',1)
        s2=Square((1+x)/2).next_to(c,UL,buff=0).set_fill('#ffc478',1)
        s3=s2.copy().shift(LEFT*(1+x)/2)
        s4=Square(1+x/3).next_to(d,UR,buff=0).set_fill('#bbdfc8',1)
        s5=Square(0.5+x/6).next_to(s4,UP,buff=0).shift(LEFT*(0.5+x/6)/2).set_fill('#f0e5d8',1)
        s6=Square(0.5+x/6).next_to(s4,UP,buff=0).shift(RIGHT*(0.5+x/6)/2).set_fill('#f0e5d8',1)
        s7=Square(2+x/3).next_to(a,DR,buff=0).set_fill(RED,1)
        self.add(p,s1,s2,s3,s4,s5,s6,s7)
        self.play(frame.animate.set_width(18))
        t=Tex('1').move_to([-1,-0.4,0])
        ts=Tex('?').move_to(s1.get_center())
        self.add(t,ts,Tex('x').next_to(s1,UP),Tex('y').next_to(s5,LEFT))
        self.wait()